
class wxpay{
	constructor(arg) {
	    this.config=arg;
		this.packages=arg.package
	}

	pay(){
		 return new Promise((resolve, reject) => {
			uni.requestPayment({
				provider: 'wxpay',
				timeStamp:this.config.timestamp,
				nonceStr:this.config.noncestr,
				package:this.packages,
				signType:this.config.signtype,
				paySign:this.config.paysign,
				success: function (res) {
					console.log(res)
				   resolve(res);
				},
				fail: function (err) {
					// uni.redirectTo({
					// 	url:"../../pages/book/index"
					// })
						reject(err);
				},
					complete: res => {
						console.error(res)
					}
					
			});
		})
	}
}


 export default wxpay